//
//  FinishedOrderFooter.m
//  RRQS
//
//  Created by kuyuZJ on 16/8/18.
//
//

#import "FinishedOrderFooter.h"


@interface FinishedOrderFooter ()

@property(nonatomic,strong) UILabel* labelSumTitle;
@property(nonatomic,strong) UILabel* labelSumMoney;
@property(nonatomic,strong) UIImageView* line;

@property(nonatomic,strong) UILabel* labelOrderNO;
@property(nonatomic,strong) UILabel* labelPayWay;
@property(nonatomic,strong) UIImageView* line2;

@property(nonatomic,strong) UIButton* btnStore;
@property(nonatomic,strong) UIButton* btnUser;
@property(nonatomic,strong) UIButton* btnStatus;

@property(nonatomic,strong) UIView* bottomView;

@end

@implementation FinishedOrderFooter

-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if(self){
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self layoutUI];
        [self layoutConstraints];
    }
    return self;
}

#pragma mark =====================================================  user interface layout
-(void)layoutUI{
    [self.contentView addSubview:self.labelSumTitle];
    [self.contentView addSubview:self.labelSumMoney];
    [self.contentView addSubview:self.line];
    [self.contentView addSubview:self.labelOrderNO];
    [self.contentView addSubview:self.labelPayWay];
    [self.contentView addSubview:self.line2];
    [self.contentView addSubview:self.btnStore];
    [self.contentView addSubview:self.btnUser];
    [self.contentView addSubview:self.btnStatus];
    [self.contentView addSubview:self.bottomView];
    
    CALayer* border = [[CALayer alloc]init];
    border.frame = CGRectMake(0, 0, SCREEN_WIDTH, 1.0f);
    border.backgroundColor = [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f].CGColor;
    [self.contentView.layer addSublayer:border];
}

-(void)layoutConstraints{
    self.labelSumTitle.translatesAutoresizingMaskIntoConstraints = NO;
    self.labelSumMoney.translatesAutoresizingMaskIntoConstraints = NO;
    self.line.translatesAutoresizingMaskIntoConstraints = NO;
    
    self.labelOrderNO.translatesAutoresizingMaskIntoConstraints = NO;
    self.labelPayWay.translatesAutoresizingMaskIntoConstraints = NO;
    self.line2.translatesAutoresizingMaskIntoConstraints = NO;
    
    self.btnStore.translatesAutoresizingMaskIntoConstraints = NO;
    self.btnUser.translatesAutoresizingMaskIntoConstraints = NO;
    self.btnStatus.translatesAutoresizingMaskIntoConstraints = NO;
    
    self.bottomView.translatesAutoresizingMaskIntoConstraints = NO;
    
    
    [self.labelSumTitle addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumTitle attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH/2]];
    [self.labelSumTitle addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumTitle attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumTitle attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumTitle attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10.f]];
    
    [self.labelSumMoney addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumMoney attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH/2]];
    [self.labelSumMoney addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumMoney attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumMoney attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelSumMoney attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10.f]];
    
    [self.line addConstraint:[NSLayoutConstraint constraintWithItem:self.line attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1.0f]];
    [self.line addConstraint:[NSLayoutConstraint constraintWithItem:self.line attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.line attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.labelSumTitle attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.line attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.f]];
    
    [self.labelOrderNO addConstraint:[NSLayoutConstraint constraintWithItem:self.labelOrderNO attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH*2/3]];
    [self.labelOrderNO addConstraint:[NSLayoutConstraint constraintWithItem:self.labelOrderNO attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelOrderNO attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.line attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelOrderNO attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10.f]];
    
    [self.labelPayWay addConstraint:[NSLayoutConstraint constraintWithItem:self.labelPayWay attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH/3]];
    [self.labelPayWay addConstraint:[NSLayoutConstraint constraintWithItem:self.labelPayWay attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelPayWay attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.line attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.labelPayWay attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10.f]];
    
    [self.line2 addConstraint:[NSLayoutConstraint constraintWithItem:self.line2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1.0f]];
    [self.line2 addConstraint:[NSLayoutConstraint constraintWithItem:self.line2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SCREEN_WIDTH]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.line2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.labelOrderNO attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.line2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.f]];
    
    CGFloat width = (SCREEN_WIDTH-40)/3;
    [self.btnStore addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStore attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]];
    [self.btnStore addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStore attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStore attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.line2 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStore attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10.f]];
    
    [self.btnUser addConstraint:[NSLayoutConstraint constraintWithItem:self.btnUser attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]];
    [self.btnUser addConstraint:[NSLayoutConstraint constraintWithItem:self.btnUser attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnUser attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.line2 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnUser attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.btnStore attribute:NSLayoutAttributeRight multiplier:1.0 constant:10.f]];
    
    [self.btnStatus addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStatus attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width]];
    [self.btnStatus addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStatus attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStatus attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.line2 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.btnStatus attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10.f]];
    
    [self.bottomView addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:10.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.f]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.f]];
}

#pragma mark =====================================================  SEL
-(IBAction)connectionTouch:(UIButton*)sender{
    EnumOrderAction action;
    NSString* phone;
    if(self.btnStore == sender){
        action = connectionBusiness;
        phone = self.entity.storePhone;
    }else if (self.btnUser == sender ){
        action = connectionClient;
        phone = self.entity.userPhone;
    }else{
        action = confirmTake;
    }
    if(self.btnStatus == sender){
        if(self.delegate && [self.delegate respondsToSelector:@selector(orderDetailTake:)]){
            [self.delegate orderDetailTake:self.entity];
        }
    }else{
        if(self.delegate && [self.delegate respondsToSelector:@selector(orderDetailEnum:phone:)]){
            [self.delegate orderDetailEnum:action phone:phone];
        }
    }
}

#pragma mark =====================================================  property package
-(void)setEntity:(MStore *)entity{
    if(entity){
        _entity = entity;
        self.labelSumMoney.text = entity.sumMoney;
        self.labelOrderNO.text = [NSString stringWithFormat:@"订单号 : %@",entity.subOrderID];
        self.labelPayWay.text = entity.payType;
        
//        6 确认取货
//        7 确认送达
//        8 已送达
//        9 已完成
//        10 已评价
//        11 已取消
//        12 待确认
//        13 商家已接单
         if( entity.statusIn == 6){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = YES;
             [self.btnStatus setTitle:@"确认取货" forState:UIControlStateNormal];
             [self.btnStatus setBackgroundColor:[UIColor colorWithRed:76/255.f green:182/255.f blue:226/255.f alpha:1.0]];
             
         }else if( entity.statusIn == 7){
             
             self.btnStatus.userInteractionEnabled = NO;
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             [self.btnStatus setTitle:@"确认送达" forState:UIControlStateNormal];
             
         }else if( entity.statusIn == 8){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"已送达" forState:UIControlStateNormal];
             
             
         }else if( entity.statusIn == 9){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"已完成" forState:UIControlStateNormal];
             
         }else if( entity.statusIn == 10){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"已评价" forState:UIControlStateNormal];
             
         }else if( entity.statusIn == 11){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"已取消" forState:UIControlStateNormal];
             
             
         }else if( entity.statusIn == 12){
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"待确认" forState:UIControlStateNormal];
             
         }else{
             
             
             self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
             self.btnStatus.userInteractionEnabled = NO;
             [self.btnStatus setTitle:@"已接单" forState:UIControlStateNormal];
             
         }
        
        
        
        
//        if( entity.status == expressStatusFinished){
//            self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
//            self.btnStatus.userInteractionEnabled = NO;
//            [self.btnStatus setTitle:@"已完成" forState:UIControlStateNormal];
//        }else if (entity.status == expressStatusIng){
//            if(self.isWaitTask) {
//                self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
//                self.btnStatus.userInteractionEnabled = NO;
//                [self.btnStatus setTitle:@"已取货" forState:UIControlStateNormal];
//            }else{
//                self.btnStatus.userInteractionEnabled = NO;
//                self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
//                [self.btnStatus setTitle:@"确认送达" forState:UIControlStateNormal];
//            }
//        }else if (entity.status == expressStatusCanceling || entity.status == expressStatusCancelled){
//            self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
//            self.btnStatus.userInteractionEnabled = NO;
//            [self.btnStatus setTitle:@"已取消" forState:UIControlStateNormal];
//        }else if(entity.status == expressStatusWating){
//            self.btnStatus.backgroundColor = [UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0];
//            self.btnStatus.userInteractionEnabled = YES;
//            [self.btnStatus setTitle:@"确认取货" forState:UIControlStateNormal];
//            [self.btnStatus setBackgroundColor:[UIColor colorWithRed:76/255.f green:182/255.f blue:226/255.f alpha:1.0]];
//        }
        
    }
}

-(UILabel *)labelSumTitle{
    if(!_labelSumTitle){
        _labelSumTitle = [[UILabel alloc]init];
        _labelSumTitle.textColor = [UIColor colorWithRed:152/255.f green:152/255.f blue:152/255.f alpha:1.0];
        _labelSumTitle.text = @"总计";
        _labelSumTitle.textAlignment = NSTextAlignmentLeft;
        _labelSumTitle.font = [UIFont systemFontOfSize:14.f];
    }
    return _labelSumTitle;
}

-(UILabel *)labelSumMoney{
    if(!_labelSumMoney){
        _labelSumMoney = [[UILabel alloc]init];
        _labelSumMoney.textColor = [UIColor colorWithRed:152/255.f green:152/255.f blue:152/255.f alpha:1.0];
        _labelSumMoney.textAlignment = NSTextAlignmentRight;
        _labelSumMoney.font = [UIFont systemFontOfSize:14.f];
    }
    return _labelSumMoney;
}

-(UIImageView *)line{
    if(!_line){
        _line = [[UIImageView alloc]init];
        _line.backgroundColor =  [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f];
    }
    return _line;
}

-(UILabel *)labelOrderNO{
    if(!_labelOrderNO){
        _labelOrderNO = [[UILabel alloc]init];
        _labelOrderNO.textColor = [UIColor colorWithRed:152/255.f green:152/255.f blue:152/255.f alpha:1.0];
        _labelOrderNO.textAlignment = NSTextAlignmentLeft;
        _labelOrderNO.font = [UIFont systemFontOfSize:14.f];
    }
    return _labelOrderNO;
}

-(UILabel *)labelPayWay{
    if(!_labelPayWay){
        _labelPayWay = [[UILabel alloc]init];
        _labelPayWay.textColor = [UIColor colorWithRed:152/255.f green:152/255.f blue:152/255.f alpha:1.0];
        _labelPayWay.textAlignment = NSTextAlignmentRight;
        _labelPayWay.font =[UIFont systemFontOfSize:14.f];
    }
    return _labelPayWay;
}

-(UIImageView *)line2{
    if(!_line2){
        _line2 = [[UIImageView alloc]init];
        _line2.backgroundColor =  [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f];
    }
    return _line2;
}

-(UIButton *)btnStore
{
    if(!_btnStore){
        _btnStore = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnStore.layer.masksToBounds = YES;
        _btnStore.layer.cornerRadius = 5.f;
        _btnStore.layer.borderColor = [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f].CGColor;
        _btnStore.layer.borderWidth = 1.f;
        [_btnStore setTitle:@"联系商家" forState:UIControlStateNormal];
        [_btnStore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_btnStore setBackgroundColor:[UIColor whiteColor]];
        _btnStore.titleLabel.font = [UIFont systemFontOfSize:14.f];
        [_btnStore addTarget:self action:@selector(connectionTouch:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnStore;
}

-(UIButton *)btnUser{
    if(!_btnUser){
        _btnUser = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnUser.layer.masksToBounds = YES;
        _btnUser.layer.cornerRadius = 5.f;
        _btnUser.layer.borderColor = [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f].CGColor;
        _btnUser.layer.borderWidth = 1.f;
        [_btnUser setTitle:@"联系顾客" forState:UIControlStateNormal];
        [_btnUser setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_btnUser setBackgroundColor:[UIColor colorWithRed:24/255.f green:180/255.f blue:152/255.f alpha:1.0]];
        _btnUser.titleLabel.font = [UIFont systemFontOfSize:14.f];
        [_btnUser addTarget:self action:@selector(connectionTouch:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btnUser;
}

-(UIButton *)btnStatus{
    if(!_btnStatus){
        _btnStatus = [UIButton buttonWithType:UIButtonTypeCustom];
        _btnStatus.layer.masksToBounds = YES;
        _btnStatus.layer.cornerRadius = 5.f;
        _btnStatus.layer.borderColor = [UIColor colorWithRed:231/255.0f green:231/255.0f blue:231/255.0f alpha:1.0f].CGColor;
        _btnStatus.layer.borderWidth = 1.f;
        [_btnStatus setTitle:@"已送达" forState:UIControlStateNormal];
        [_btnStatus setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_btnStatus setBackgroundColor:[UIColor colorWithRed:167/255.f green:167/255.f blue:167/255.f alpha:1.0]];
        _btnStatus.titleLabel.font = [UIFont systemFontOfSize:14.f];
        [_btnStatus addTarget:self action:@selector(connectionTouch:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _btnStatus;
}

-(UIView *)bottomView{
    if(!_bottomView){
        _bottomView = [[UIView alloc]init];
        _bottomView.backgroundColor = [UIColor colorWithRed:241/255.f green:241/255.f blue:241/255.f alpha:1.0];
    }
    return _bottomView;
}
@end
